/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dialog;

import main.Demo;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JDialog;

/**
 *
 * @author phat10130059
 */
public class ShowImage extends javax.swing.JPanel {

    /**
     * Creates new form ShowImage
     */
    public ShowImage(JDialog jdialog, String image, String filePath) {
        initComponents();




        BufferedImage img = null;
        try {
            img = ImageIO.read(new File(filePath + File.separator + image));
        } catch (IOException e) {
            e.printStackTrace();
        }

        Image scaledInstance = img.getScaledInstance(800,
                600, Image.SCALE_SMOOTH);

        ImageIcon icon = new ImageIcon(scaledInstance);

        jLabel1.setIcon(icon);


       

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();

        setLayout(new java.awt.BorderLayout());

        jLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        add(jLabel1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}
